com.cete.dynamicpdf
Class AnnotationShowHideAction
Example : The following example shows how to use annotation show hide action.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.pageelements.forms.*;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a page and add it to the document
Page page = new Page();
document.getPages().add(page);
Button button = new Button("btn", 50, 150, 100, 30);
button.setLabel("Click Here");
// Create label and text field
Label label1 = new Label("Click the button to see the form field hide action : ", 50, 100, 330, 30);
TextField field = new com.cete.dynamicpdf.pageelements.forms.TextField("Text1", 330, 100, 100, 30);
field.setDefaultValue("Text Field Value");
// Add the label, button and text field to the page
page.getElements().add(button);
page.getElements().add(field);
page.getElements().add(label1);
// Create a annotation show hide action and assign to the button events.
AnnotationShowHideAction action = new AnnotationShowHideAction("Text1");
button.getReaderEvents().setMouseDown(action);
// Save the PDF
document.draw( "[physicalpath]/MyDocument.pdf" );
}
}